DicTypeForm = Ext.extend(Ext.Window, {
	formPanel : null,
	constructor : function(a) {
		Ext.applyIf(this, a);
		this.initUIComponents();
		DicTypeForm.superclass.constructor.call(this, {
			layout : "fit",
			items : this.formPanel,
			modal : true,
			height : 180,
			width : 400,
			maximizable : true,
			title : "分类信息",
			buttonAlign : "center",
			buttons : this.buttons
		});
	},
	initUIComponents : function() {
		this.formPanel = new Ext.FormPanel({
			layout : "form",
			bodyStyle : "padding:10px 10px 10px 10px",
			border : false,
			url : __ctxPath + "/system/saveDicType.do",
			id : "dicTypeForm",
			defaults : {
				anchor : "98%,98%"
			},
			defaultType : "textfield",
			items : [{
						xtype : "hidden",
						name : "dicType.id",
						value : this.dicTypeId == null ? "" : this.dicTypeId,
					},{
						fieldLabel : "类型"+ '<font color=red>*</font>',
						name : "dicType.dic",
						allowBlank : false
					}, {
                        fieldLabel : "类型编号"+ '<font color=red>*</font>',
                        name : "dicType.dicNo",
                        allowBlank : false
                    },{
						fieldLabel : "描述",
						name : "dicType.dicDesc",
					}, {
						fieldLabel : "是否可见",
						name : "dicType.isSys",
						value : 0,
						xtype : "hidden"
					}  ]
		});
		if (this.dicTypeId != null && this.dicTypeId != "undefined") {
			this.formPanel.loadData({
				url : __ctxPath + "/system/getDicType.do?id="+ this.dicTypeId,
				preName : "dicType",
				root : "result",
				success : function(form, action) {
					
				} 
			
			});
		}
		this.buttons = [ {
			text : "保存",
			iconCls : "btn-save",
			handler : this.save.createCallback(this.formPanel, this)
		}, {
			text : "重置",
			iconCls : "btn-reset",
			handler : this.reset.createCallback(this.formPanel)
		}, {
			text : "取消",
			iconCls : "btn-cancel",
			handler : this.cancel.createCallback(this)
		} ];
	},
	reset : function(a) {
		a.getForm().reset();
	},
	cancel : function(a) {
		a.close();
	},
	save : function(a, b) {
		var c = b.callback;
		if (a.getForm().isValid()) {
			a.getForm().submit({
				method : "POST",
				waitMsg : "正在提交数据...",
				success : function(d, f) {
					Ext.ux.Toast.msg("操作信息", "成功保存信息！");
					var e = Ext.getCmp("dicType");
					if (e != null) {
						e.root.reload();
					}
					if (c != null && c != undefined) {
						c.call(this);
					}
					b.close();
				},
				failure : function(d, e) {
					Ext.MessageBox.show({
						title : "操作信息",
						msg : "信息保存出错，请联系管理员！",
						buttons : Ext.MessageBox.OK,
						icon : Ext.MessageBox.ERROR
					});
					b.close();
				}
			});
		}
	}
});